package com.lin.demo.service.async;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Author zimingl
 * @Date 2023/4/2 22:57
 * @Description: 送积分 和 注册 不能在同一个类 否则 async 失效
 */
@Service
@Slf4j
public class SendPointService {
    @Async
    @SneakyThrows // uncheck 异常 sendPoint(String mobile) throws InterruptedException
    public void sendPoint(String mobile) {
        Thread.sleep(1000);
        log.info("mobile {} 送积分成功！", mobile);
    }
}
